<?
	$functions_uri = dirname(__FILE__) . "/engine/functions.php";
	@require_once($functions_uri);

	if(drizzo_config_file_check()) {
		drizzo_update_version_number();
		drizzo_login();
		drizzo_session_check();
		drizzo_user_info();
		drizzo_get_page_id();
		drizzo_get_page_type();
		$drizzo_global_options = drizzo_global_options();
		$user_id = session_user_id;
		$drizzo_user_options = drizzo_user_options($user_id);
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		
		<title><? echo drizzo_site_name() . ": " . ucwords(str_replace(array('/drizzo/','.php','index'),array('','','Dashboard'),$_SERVER['PHP_SELF'])) . " - Powered by Drizzo " . drizzo_version_number() . drizzo_version_status(); ?></title>
		
		<link rel="stylesheet" type="text/css" href="<? echo drizzo_admin_css(); ?>" />
		
		<script type="text/javascript" src="<? echo $drizzo_admin_js; ?>scriptaculous/prototype.js"></script>
		<script type="text/javascript" src="<? echo $drizzo_admin_js; ?>scriptaculous/scriptaculous.js?load=effects"></script>
		<script type="text/javascript" src="<? echo $drizzo_admin_js; ?>drizzo.js"></script>

	</head>
	
	<body onload="setTimezoneOffset()">
		
		<div id="header">
			
			<h1><a href="<? echo domain; ?>" title="<? echo drizzo_site_name(); ?>"><? echo drizzo_site_name(); ?></a><br /><span id="powered_by">Powered by Drizzo <small><? echo drizzo_version_number() . " " . drizzo_version_status(); ?></small></span>
			<?
				if(function_exists(drizzo_login_check)) { if(drizzo_login_check()) {
			?>
							<div id="logout"><form action="" method="post" name="logout"><input type="hidden" value="logout" name="login"></input>Hello <? echo drizzo_user_info(session_user_id,'nice_name'); ?> [ <a href="users.php?user=<? echo session_user_id; ?>" title="View Your Profile" id="profile_menu_link"><span class="menu_link">Profile</span></a> | <a href="javascript:document.logout.submit()" title="Logout" class="logout" id="logout_menu_link"><span class="menu_link">Logout</span></a> ]</form></div>
			<?
				} }
			?>
			</h1>

			<ul>
				<li<? if(strpos($_SERVER['PHP_SELF'],'index.php') > 0) { echo " class=\"current\""; } ?>><a href="/drizzo" title="Dashboard" id="base_menu_link"><span class="menu_link">Dashboard</span></a></li>
<?
	$modules = array('blog','pages','podcasts','reviews','events','gallery','media','warehouse','comments','links');
	foreach($modules as $module) {
		if($module == 'comments') {
			$allowance = 'comments-moderate';
		} elseif($module == 'links') {
			$allowance = 'links-publish-user';
		} else {
			$allowance = $module . "-write";
		}
		$option = "module_" . $module;
		if(drizzo_user_is_allowed($allowance) && drizzo_global_options($option) == 1 && $module != 'warehouse') {
?>
				<li<? if(strpos($_SERVER['PHP_SELF'],$module) > 0) { echo " class=\"current\""; } ?>><a href="/drizzo/<? echo $module; ?>.php" title="<? echo ucwords($module); ?>" id="<? echo $module; ?>_menu_link"><span class="menu_link"><? echo ucwords($module); ?></span></a></li>
<?	
		} elseif($module == 'warehouse' && strpos($_SERVER['PHP_SELF'],$module) > 0) {
?>
				<li class="current"><a id="warehouse_menu_link" class="menu_link"><span>Warehouse</span></a></li>
<?
		}
	}
?>
				<li<? if(strpos($_SERVER['PHP_SELF'],'users.php') > 0) { echo " class=\"current\""; } ?>><a href="/drizzo/users.php" title="Users" id="users_menu_link"><span class="menu_link">Users</span></a></li>
<?
	if(drizzo_user_is_allowed('options')) {
?>
				<li<? if(strpos($_SERVER['PHP_SELF'],'options.php') > 0) { echo " class=\"current\""; } ?>><a href="/drizzo/options.php" title="Options" id="options_menu_link"><span class="menu_link">Options</span></a></li>
<?
	}
	if(drizzo_user_is_allowed('plugins')) {
?>
				<li<? if(strpos($_SERVER['PHP_SELF'],'plugins.php') > 0) { echo " class=\"current\""; } ?>><a href="/drizzo/plugins.php" title="Plugins" id="plugins_menu_link"><span class="menu_link">Plugins</span></a></li>
<?
	}
?>
				<li<? if(strpos($_SERVER['PHP_SELF'],'help.php') > 0) { echo " class=\"current\""; } ?>><a href="/drizzo/help.php" title="Help" id="help_menu_link"><span class="menu_link">Help</span></a></li>

				<div class="clear"></div>

			</ul>
			
		</div>
<? if(function_exists(drizzo_protector)) { drizzo_protector(); } ?>
